import { MENU } from '@/services/admin/typings'
import { Tree } from 'antd'

export interface PermTreeProps {
  data?: MENU.MenuTreeVO[]
  onCheck?: (selectedKeys: any, info: any) => void
  selectKeys: number[]
}

const PermTree = (props: PermTreeProps) => {
  return (
    <>
      {props.data && (
        <Tree
          checkable
          checkedKeys={props.selectKeys}
          onCheck={props.onCheck}
          fieldNames={{ title: 'name', key: 'id' }}
          treeData={props.data}
        />
      )}
    </>
  )
}

export default PermTree
